module.exports = () => {
    return async(ctx,next) => {
        //1.排除接口  查询接口
        let writePath = ['/api/address'];
        if(writePath.includes(ctx.path) && ctx.method === 'GET'){
             await next();
        }else{
            //权限验证
            let indentity = ctx.get('egg-identity');
            if(indentity && indentity === 'admin'){
                await next();
            }else{
                ctx.body = {
                    code:4,
                    msg:'您没有权限',
                    status:401
                }
            }
        }
    }
}